package bussinessService.impl;

import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

import utils.DateUtil;
import module.KPI;
import bussinessService.kpiBussinessSerivce;
import domain.vo.KPIVO;
import domain.vo.queryObject;

public class KPIBussinessServiceImpl  implements kpiBussinessSerivce{

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#getById(java.lang.String)
	 */

	public KPI getById(String id) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#getAll()
	 */

	public List<KPIVO> getAll() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#merageObject(java.lang.Object)
	 */

	public void merageObject(KPI t) throws SQLException {
		kpiService.insertObject(t);
		
	}

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#deleteT(java.lang.Object)
	 */

	public void deleteT(int id) throws SQLException {
		
	}

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#getObjectByQueryObject(domain.vo.queryObject)
	 */

	public List<KPIVO> getObjectByQueryObject(queryObject queryObject)
			throws SQLException {
		List<KPIVO> vos = new LinkedList<KPIVO>();
		List<KPI> kpis = new LinkedList<KPI>();

		kpis = kpiService.getObjectByQueryObject(queryObject);
		for(KPI kpi : kpis){		
			KPIVO vo = new KPIVO();
			vo.setEname(kpi.getEname());
			vo.setGroupName(kpi.getGroupName());
			vo.setMoney(Integer.parseInt(kpi.getMoney()));		
			vo.setCreateTime(kpi.getDay());
			vos.add(vo);
		}
		return vos;
	}

	/* (non-Javadoc)
	 * @see bussinessService.basicbussinessService#countByQueryObject(domain.vo.queryObject)
	 */

	public int countByQueryObject(queryObject queryObject) throws SQLException {
		return kpiService.countByQueryObject(queryObject);
	}

}
